package com.joysuch.wwyt.core.entity;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.util.Objects;

/**
 * @author : pp
 * @date : Created in 2021/4/13 11:01
 */
@Entity
@Table(name = "wwyt_base_role_data_auth", schema = "wwyt", catalog = "")
public class BaseRoleDataAuth {
    private Long id;
    private Long tenentId;
    private String orgCode;
    /**
     * 角色id
     */
    @NotNull(message = "角色id不能为空")
    private Long roleId;
    /**
     * 数据权限类型 0-组织/1-人员
     */
    @NotNull(message = "数据权限类型:0-组织/1-人员 不能为空")
    private Integer dataAuthType;

    /**
     * 是否包含子部门 0-是/1-否
     */

    private Integer containChild;
    /**
     *组织编号
     */

    private String departCode;
    /**
     *所选部门id  如果选择所在组织则为 -1
     */
    private Long departId;
    /**
     *人员工号
     */
    private String userCode;
    /**
     *所选员工id集合 json字符串  如果选择本人则为 -1
     */
    private String userIdJson;

    @Id
    @Column(name = "ID")
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    @Basic
    @Column(name = "TENENT_ID")
    public Long getTenentId() {
        return tenentId;
    }

    public void setTenentId(Long tenentId) {
        this.tenentId = tenentId;
    }

    @Basic
    @Column(name = "ORG_CODE")
    public String getOrgCode() {
        return orgCode;
    }

    public void setOrgCode(String orgCode) {
        this.orgCode = orgCode;
    }

    @Basic
    @Column(name = "ROLE_ID")
    public Long getRoleId() {
        return roleId;
    }

    public void setRoleId(Long roleId) {
        this.roleId = roleId;
    }

    @Basic
    @Column(name = "DATA_AUTH_TYPE")
    public Integer getDataAuthType() {
        return dataAuthType;
    }

    public void setDataAuthType(Integer dataAuthType) {
        this.dataAuthType = dataAuthType;
    }

    @Basic
    @Column(name = "CONTAIN_CHILD")
    public Integer getContainChild() {
        return containChild;
    }

    public void setContainChild(Integer containChild) {
        this.containChild = containChild;
    }

    @Basic
    @Column(name = "DEPART_CODE")
    public String getDepartCode() {
        return departCode;
    }

    public void setDepartCode(String departCode) {
        this.departCode = departCode;
    }

    @Basic
    @Column(name = "DEPART_ID")
    public Long getDepartId() {
        return departId;
    }

    public void setDepartId(Long departId) {
        this.departId = departId;
    }

    @Basic
    @Column(name = "USER_CODE")
    public String getUserCode() {
        return userCode;
    }

    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }

    @Basic
    @Column(name = "USER_ID_JSON")
    public String getUserIdJson() {
        return userIdJson;
    }

    public void setUserIdJson(String userIdJson) {
        this.userIdJson = userIdJson;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        BaseRoleDataAuth that = (BaseRoleDataAuth) o;
        return id == that.id &&
                Objects.equals(tenentId, that.tenentId) &&
                Objects.equals(orgCode, that.orgCode) &&
                Objects.equals(roleId, that.roleId) &&
                Objects.equals(dataAuthType, that.dataAuthType) &&
                Objects.equals(containChild, that.containChild) &&
                Objects.equals(departCode, that.departCode) &&
                Objects.equals(departId, that.departId) &&
                Objects.equals(userCode, that.userCode) &&
                Objects.equals(userIdJson, that.userIdJson);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, tenentId, orgCode, roleId, dataAuthType, containChild, departCode, departId, userCode, userIdJson);
    }
}
